package cn.com.utils;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class MybatisUtils {

	private static SqlSessionFactory factory;
	static{
		try{
			factory = new SqlSessionFactoryBuilder()
				.build(Resources.getResourceAsStream("cn/com/mapper/sqlMapConfig.xml"));
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public static SqlSession openSession(){
		return factory.openSession();
	}

}
